#pragma once
#include "nocopy.h"
class InetAddress;
class Socket : nocopyable
{
public:
    Socket(int socketfd) : sockfd_(socketfd) {}
    ~Socket();
    int fd() const { return sockfd_; }
    void bindAddress(const InetAddress &localaddr);
    void listen();
    int accept(InetAddress *peeraddr);
    void shutdownWrite();
    void setKeepAlive(bool on);
    void setReuseAddr(bool on);
    void serReusePort(bool on);
    void setTcpNoDelay(bool on);

private:
    const int sockfd_;
};